import grails.test.*

class EventTests extends GrailsUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

  void testValidationOnEvent() {
    def c = new Volunteer(firstName: 'Bugs', lastName: 'Bunny', email: 'bugsbunny@warnerbros.com', password: 'bb')
    c.save()

    def event = new Event(name: "event1", description: "e1d1", location: "e1l1", startDate: new Date(), endDate: new Date() + 7, owner: c).save()

    assert true == event.validate()

    // shouldn't validate
    event.endDate = new Date() -3
    assert false == event.validate()

    // now try a valid endDate
    event.endDate = new Date() + 6
    assert true == event.validate()

  }
}
